# Contributor: Jakob Meier <comcloudway@ccw.icu>
# Maintainer: Jakob Meier <comcloudway@ccw.icu>
pkgname=tractor
pkgver=4.5.1
pkgrel=0
pkgdesc="Setup an onion routing proxy "
url="https://framagit.org/tractor/tractor"
# s390x: blocked by tor
arch="noarch !s390x"
license="GPL-3.0-or-later"
depends="
	gsettings-desktop-schemas
	py3-fire
	py3-gobject3
	py3-pysocks
	py3-stem
	tor
"
makedepends="py3-gpep517 py3-setuptools py3-wheel py3-pytest"
subpackages="$pkgname-doc $pkgname-pyc"
source="https://framagit.org/tractor/tractor/-/archive/$pkgver/tractor-$pkgver.tar.gz
	recursively_look_for_schemas.patch
	"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	install -Dm644 data/tractor.1 "$pkgdir/usr/share/man/man1"
	install -Dm644 src/tractor/SampleBridges "$pkgdir/usr/share/tractor/SampleBridges"
	install -Dm644 src/tractor/tractor.gschema.xml "$pkgdir/usr/share/glib-2.0/schemas/tractor.gschema.xml"
	glib-compile-schemas "$pkgdir/usr/share/glib-2.0/schemas"
}
sha512sums="
8c0e01598042177dd8907f783fdd6eca4837036493484b125ed5540cf00efaa9d255794a8d87305cc8a8e9228eb98ff7e7045476e5b41158ffc4142c0151f1e7  tractor-4.5.1.tar.gz
cda1e07799ba2d4acfc54953eda8fee2828a17e127fb4513624c492a5ea89ff4887a0e418a162549e34d37ce510c4c1064d0221605be862f0420ee39b7f9453e  recursively_look_for_schemas.patch
"
